package cn.example.vip.mall.page.controller;

import cn.example.vip.mall.page.service.PageService;
import cn.example.vip.mall.util.RespResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin(maxAge = 3600)
@RestController
@RequestMapping("/page")
public class PageController {
	
	@Autowired
	private PageService pageService;
	
	/**
	 * 静态页生成
	 */
	@GetMapping("/{id}")
	public RespResult html(@PathVariable("id")String id) throws Exception {
		pageService.html(id);
		return RespResult.ok();
	}
	
	/**
	 * 删除静态页
	 */
	@DeleteMapping("/{id}")
	public RespResult delete(@PathVariable("id")String id) {
		pageService.delHtml(id);
		return RespResult.ok();
	}
}
